//
// Created by francklinson on 2021/10/21 AT 10:16.
//
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>
#include <functional>
#include <climits>
#include <string>

using namespace std;

class Solution {
public:
    bool canBeIncreasing(vector<int> &nums) {
        for (int i = 1; i < nums.size(); ++i) {
            if (nums[i] <= nums[i - 1]) {
                return check(nums, i) or check(nums, i - 1);
            }
        }
        return true;
    }

    /**
     * 检查 nums中删去index位置的数字后 是不是严格递增的
     * @param num
     * @param index
     * @return
     */
    bool check(vector<int> &nums, int index) {
        for (int i = 1; i < nums.size() - 1; ++i) {
            int pre = i - 1;
            if (pre >= index) ++pre;
            int cur = i;
            if (cur >= index) ++cur;
            if (nums[cur] <= nums[pre])
                return false;
        }
        return true;
    }
};

int main() {
    vector<int> nums{1, 2, 10, 5, 7};
    Solution solution;
    cout << solution.canBeIncreasing(nums) << endl;
    return 0;
}

